<template>
  <div class="year-container">
    <div class="title">
      <p>利润散点图</p>
      <img src="../images/dataScreen-title.png" alt="" />
    </div>
    <div ref="chartContainer" class="chart-container"></div>
  </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'

let chartContainer = ref()
const option = {
  title: {
    text: '散点图',
    left: '40%',
    textStyle: {
      color: 'aqua',
    },
  },
  xAxis: {
    type: 'category',
    show: false,
  },
  yAxis: {
    show: false,
  },
  grid: {
    left: 10,
    bottom: 10,
    right: 0,
    top: 20,
  },
  series: [
    {
      type: 'scatter',
      data: [
        33, 448, 56, 78, 12, 385, 41, 36, 98, 56, 12, 33, 14, 78, 654, 853, 147,
      ],
      symbol: 'pin',
      label: {
        show: true,
      },
    },
  ],
}
onMounted(() => {
  let myChart = echarts.init(chartContainer.value)
  myChart.setOption(option)
})
</script>

<style lang="scss" scoped>
.year-container {
  margin-top: 20px;
  width: 100%;
  height: 100%;
  background: url('../images/dataScreen-main-lt.png') no-repeat;
  background-size: 100% 100%;
  .title {
    padding-left: 10px;
    p {
      color: #fff;
    }
  }
  .chart-container {
    margin-top: 20px;
    height: 220px;
  }
}
</style>
